package com.imoocdl.service;

import com.imoocdl.dataobject.ProductInfo;
import com.imoocdl.dto.CartDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by pc on 2018/3/30.
 */

public interface ProductService {
    ProductInfo findOne(String productId);

    /**
     * 在架商品
     * @return
     */
    List<ProductInfo> findUpAll();

    /**
     * 分页查询所有
     * @param pageable
     * @return
     */
    Page<ProductInfo> findAll(Pageable pageable);

    ProductInfo save(ProductInfo productInfo);

    //加库存
    void increaseStock(List<CartDTO> cartDTOList);

    //减库存
    void decreaseStock(List<CartDTO> cartDTOList);

    //上架
    ProductInfo onSale(String productId);

    //下架
    ProductInfo offSale(String productId);

}
